package com.tuyue.police.pojo;

import javax.persistence.*;

/**
 * @Author: 王金海
 * @Description: 设备
 * @Date: Created by Administrator on 2018/3/13.
 * @Modified By:
 */
@Entity
public class Device {
    private long deviceId;
    private long deviceEnterpriseId;
    private long deviceServerId;
    private long deviceTypeId;
    private String deviceSerialNumber;
    private Integer deviceSectorNumber;
    private String deviceMainPort;

    private Integer deviceSectorSize;
    //所属企业
    private String ename;
    //设备类型
    private String deviceTypeName;

    @Transient
    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }
    @Transient
    public String getDeviceTypeName() {
        return deviceTypeName;
    }

    public void setDeviceTypeName(String deviceTypeName) {
        this.deviceTypeName = deviceTypeName;
    }

    @Transient
    public Integer getDeviceSectorSize() {
        return deviceSectorSize;
    }

    public void setDeviceSectorSize(Integer deviceSectorSize) {
        this.deviceSectorSize = deviceSectorSize;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "device_id")
    public long getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(long deviceId) {
        this.deviceId = deviceId;
    }

    @Basic
    @Column(name = "device_enterprise_id")
    public long getDeviceEnterpriseId() {
        return deviceEnterpriseId;
    }

    public void setDeviceEnterpriseId(long deviceEnterpriseId) {
        this.deviceEnterpriseId = deviceEnterpriseId;
    }

    @Basic
    @Column(name = "device_server_id")
    public long getDeviceServerId() {
        return deviceServerId;
    }

    public void setDeviceServerId(long deviceServerId) {
        this.deviceServerId = deviceServerId;
    }

    @Basic
    @Column(name = "device_type_id")
    public long getDeviceTypeId() {
        return deviceTypeId;
    }

    public void setDeviceTypeId(long deviceTypeId) {
        this.deviceTypeId = deviceTypeId;
    }

    @Basic
    @Column(name = "device_serial_number")
    public String getDeviceSerialNumber() {
        return deviceSerialNumber;
    }

    public void setDeviceSerialNumber(String deviceSerialNumber) {
        this.deviceSerialNumber = deviceSerialNumber;
    }

    @Basic
    @Column(name = "device_sector_number")
    public Integer getDeviceSectorNumber() {
        return deviceSectorNumber;
    }

    public void setDeviceSectorNumber(Integer deviceSectorNumber) {
        this.deviceSectorNumber = deviceSectorNumber;
    }

    @Basic
    @Column(name = "device_main_port")
    public String getDeviceMainPort() {
        return deviceMainPort;
    }

    public void setDeviceMainPort(String deviceMainPort) {
        this.deviceMainPort = deviceMainPort;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Device device = (Device) o;

        if (deviceId != device.deviceId) return false;
        if (deviceEnterpriseId != device.deviceEnterpriseId) return false;
        if (deviceServerId != device.deviceServerId) return false;
        if (deviceTypeId != device.deviceTypeId) return false;
        if (deviceSerialNumber != null ? !deviceSerialNumber.equals(device.deviceSerialNumber) : device.deviceSerialNumber != null)
            return false;
        if (deviceSectorNumber != null ? !deviceSectorNumber.equals(device.deviceSectorNumber) : device.deviceSectorNumber != null)
            return false;
        if (deviceMainPort != null ? !deviceMainPort.equals(device.deviceMainPort) : device.deviceMainPort != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (deviceId ^ (deviceId >>> 32));
        result = 31 * result + (int) (deviceEnterpriseId ^ (deviceEnterpriseId >>> 32));
        result = 31 * result + (int) (deviceServerId ^ (deviceServerId >>> 32));
        result = 31 * result + (int) (deviceTypeId ^ (deviceTypeId >>> 32));
        result = 31 * result + (deviceSerialNumber != null ? deviceSerialNumber.hashCode() : 0);
        result = 31 * result + (deviceSectorNumber != null ? deviceSectorNumber.hashCode() : 0);
        result = 31 * result + (deviceMainPort != null ? deviceMainPort.hashCode() : 0);
        return result;
    }
}
